package com.hex.ds.hdtp.core.web.script.test.vo;

import cn.hutool.core.collection.CollectionUtil;
import lombok.Data;

import java.util.List;

/**
 * @Package: com.hex.ds.hdtp.core.app.script.test.dto.request
 * @ClassName ScriptDataTestTaskRequestDto
 * @Description: 带数据测试任务VO对象
 * @Author: wz.li
 * @Date 2023/8/1 15:17
 * @Version v2.0.2
 **/
@Data
public class ScriptDataTestTaskVo {

    private String pkId;

    private String taskName;

    private String isDataAlignment;

    private String dataSyncType;

    private String dataSyncStartTime;

    private String dataSyncEndTime;

    private String status;

    private Integer testTotal;

    private Integer testSuccessCount;

    private Integer testFailCount;

    private String startTime;

    private String endTime;

    private List<String> customTime;

    private List<ScriptDataTestListVo> testScriptList;

    public String getDataSyncStartTime() {
        if (CollectionUtil.isNotEmpty(customTime) && customTime.size() == 2){
            return customTime.get(0);
        }
        return dataSyncStartTime;
    }

    public String getDataSyncEndTime() {
        if (CollectionUtil.isNotEmpty(customTime) && customTime.size() == 2){
            return customTime.get(1);
        }
        return dataSyncEndTime;
    }

    public Integer getTestTotal() {
        return testScriptList.size();
    }
}
